import type {MedicineData} from "@/api/medicine";
import type {PopoverProps} from "element-plus";
import SelectMedicinePopover from "@/component/select-medicine/SelectMedicinePopover.vue";

type SelectMedicinePopoverInstance = InstanceType<typeof SelectMedicinePopover>

interface SelectMedicineBasicProps {
    prop: 'code' | 'endcode' | 'name' | 'nactionInsurCode' // 筛选字段
    label: string // 筛选标签名称
    value: string | number // 搜索值
    isAuto?: boolean
}

interface SelectMedicineEmit {
    selectionChange: [newSelection: MedicineData]
}

type SelectMedicinePopoverProps = SelectMedicineBasicProps & Omit<Partial<PopoverProps>, 'visible'>

interface SelectMedicineInput extends Omit<SelectMedicinePopoverProps, 'value'> {
    dataProps?: Record<
        'id' |
        'code' |
        'endcode' |
        'name' |
        'spec' |
        'unit' |
        'prescribeUnit' |
        'nactionInsurCode' |
        'qty' |
        'price' |
        string, string>
}

export type {
    SelectMedicineBasicProps,
    SelectMedicinePopoverProps,
    SelectMedicineInput,
    SelectMedicineEmit,
    SelectMedicinePopoverInstance
}